package com.example.smartcanteen.controller;

import com.example.smartcanteen.model.Admin;
import com.example.smartcanteen.model.Goods;
import com.example.smartcanteen.service.AdminService;
import com.example.smartcanteen.utils.ResponseMessage;
import jdk.swing.interop.SwingInterOpUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admiN")
@CrossOrigin
public class AdminController {
    @Autowired
    private AdminService adminService;


    //管理员登录 所需数据：String username；String password；
    @PostMapping("/login")
    ResponseMessage login(Admin admin) {


        return adminService.login(admin);
    }


    //所需数据： int shopID；int state；
    @PostMapping("/applyShop")
    ResponseMessage applyShop(Integer shopID,String state) {
        System.out.println(shopID);
        System.out.println(state);

        return adminService.applyShop(shopID,state);
    }


    //所需数据：int shopID；String goodsname；int newstate
    @PostMapping("/applyGoods")
    ResponseMessage applyGoods(int shopID,String goodsname, String newstate) {


        return adminService.applyGoods(shopID,goodsname,newstate);
    }
}
